﻿package mortal.game.control
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import __AS3__.vec.*;
    import com.gengine.core.frame.*;
    import com.gengine.manager.*;
    import com.gengine.resource.*;
    import com.gengine.resource.info.*;
    import extend.language.*;
    import extend.php.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.net.*;
    import flash.utils.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.mvc.*;
    import mortal.game.proxy.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.player.info.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.common.util.*;
    import mortal.game.view.guide.*;
    import mortal.game.view.platform.*;
    import mortal.game.view.shop.*;
    import mortal.game.view.shopMall.*;
    import mortal.game.view.shopMall.data.*;
    import mortal.game.view.shopMall.shopQQ.*;
    import mortal.game.view.shopMall.shopSecKilling.*;
    import mortal.game.view.shopMall.view.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class ShopMallController extends Controller
    {
        private var _shopMallModule:ShopMallModule;
        private var _shopProxy:ShopProxy;
        private var _buyDic:Dictionary;
        private var _buyTime:Dictionary;
        private var _shopItemData:ShopItemData;
        private var lastAskGetRebatTime:Number = 0;

        public function ShopMallController()
        {
            this._buyDic = new Dictionary();
            this._buyTime = new Dictionary();
            this.init();
            return;
        }// end function

        private function init() : void
        {
            this._shopProxy = GameProxy.shop;
            return;
        }// end function

        override protected function initView() : IView
        {
            if (this._shopMallModule == null)
            {
                this._shopMallModule = new ShopMallModule();
                this._shopMallModule.addEventListener(WindowEvent.SHOW, this.onWinShow);
                this._shopMallModule.addEventListener(WindowEvent.CLOSE, this.onWinClose);
            }
            return this._shopMallModule;
        }// end function

        override protected function initServer() : void
        {
            Dispatcher.addEventListener(EventName.LoginGameSuccess, this.showQQShopIcon);
            Dispatcher.addEventListener(EventName.ShopMallInit, this.updateWindow);
            Dispatcher.addEventListener(EventName.BuyItem, this.buyItem);
            Dispatcher.addEventListener(EventName.ShopMallOpenAndSelect, this.openWinAndSelect);
            Dispatcher.addEventListener(EventName.RebateShopGetPanicBuyConfig, this.getRebatConfig);
            Dispatcher.addEventListener(EventName.ShopMallChangeTabIndex, this.changeTab);
            Dispatcher.addEventListener(EventName.ShowBindCoinPackWin, this.showBindCoinPackWin);
            Dispatcher.addEventListener(EventName.ShowCoinPackWin, this.showCoinPackWin);
            Dispatcher.addEventListener(EventName.BestGetRebatShopConfig, this.bestGetRebatShopConfig);
            Dispatcher.addEventListener(EventName.ShopShowArrowToRebate, this.shopShowArrow);
            Dispatcher.addEventListener(EventName.RebateShopBuyItem, this.onBuyItem);
            Dispatcher.addEventListener(EventName.ActiveStart, this.activesStartHandler);
            Dispatcher.addEventListener(EventName.ActiveNotic, this.activesNoticHandler);
            Dispatcher.addEventListener(EventName.ActiveEnd, this.activesEndHandler);
            Cache.instance.role.roleEntityInfo.addEventListener(EntityInfoEventName.UpdateLevel, this.showSeckillingIcon);
            return;
        }// end function

        private function onWinShow(event:Event) : void
        {
            NetDispatcher.addCmdListener(ServerCommand.MoneyUpdate, this.updateMoney);
            NetDispatcher.addCmdListener(ServerCommand.RuneLevelUp, this.updateRuneShop);
            NetDispatcher.addCmdListener(ServerCommand.RuneAdd, this.updateRuneShop);
            NetDispatcher.addCmdListener(ServerCommand.RebateShopGetSOnsellItemsMsg, this.onUpdateRebateNum);
            NetDispatcher.addCmdListener(ServerCommand.RebateShopGetSOnsellPlayerMsg, this.onUpdatePlayerRecord);
            Dispatcher.addEventListener(EventName.RebateShopClose, this.onCloseShop);
            return;
        }// end function

        private function onWinClose(event:Event) : void
        {
            NetDispatcher.removeCmdListener(ServerCommand.MoneyUpdate, this.updateMoney);
            NetDispatcher.removeCmdListener(ServerCommand.RuneLevelUp, this.updateRuneShop);
            NetDispatcher.removeCmdListener(ServerCommand.RuneAdd, this.updateRuneShop);
            NetDispatcher.removeCmdListener(ServerCommand.RebateShopGetSOnsellItemsMsg, this.onUpdateRebateNum);
            NetDispatcher.removeCmdListener(ServerCommand.RebateShopGetSOnsellPlayerMsg, this.onUpdatePlayerRecord);
            Dispatcher.removeEventListener(EventName.RebateShopClose, this.onCloseShop);
            return;
        }// end function

        private function updateWindow(event:DataEvent) : void
        {
            return;
        }// end function

        private function itemAddHandler(param1:Array) : void
        {
            this.clearToBeFly();
            if (param1 == null || !(param1[0] is ItemData))
            {
                return;
            }
            var _loc_2:* = ItemData(param1[0]).itemCode;
            var _loc_3:* = this._buyDic[_loc_2];
            if (_loc_3 == null)
            {
                _loc_3 = this._buyDic[ItemData(param1[0]).itemInfo.codeUnbind];
            }
            if (_loc_3 == null || _loc_3.isDisposed)
            {
                return;
            }
            var _loc_4:* = this._buyTime[_loc_2];
            if (FrameManager.flashFrame.getTime() - _loc_4 >= 2000)
            {
                return;
            }
            var _loc_5:* = _loc_3.localToGlobal(GameConst.yellowPoint);
            FlyToNavbarTool.flyBitmapOriginalToPack(_loc_3.bitmapdata, _loc_5);
            return;
        }// end function

        private function clearToBeFly() : void
        {
            var _loc_2:* = undefined;
            var _loc_1:* = FrameManager.flashFrame.getTime();
            for (_loc_2 in this._buyTime)
            {
                
                if (_loc_1 - int(_loc_2) >= 2000)
                {
                    delete this._buyDic[_loc_2];
                    delete this._buyTime[_loc_2];
                }
            }
            return;
        }// end function

        private function buyItem(event:DataEvent) : void
        {
            var _loc_3:ShopItemData = null;
            var _loc_4:int = 0;
            var _loc_5:Dictionary = null;
            var _loc_6:SShopBuyPlayerInfo = null;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:int = 0;
            var _loc_2:* = event.data;
            if (_loc_2 is ShopItemData)
            {
                _loc_3 = _loc_2 as ShopItemData;
                _loc_4 = _loc_3.itemInfo.code;
            }
            else if (_loc_2 is ShopSellItem)
            {
                _loc_3 = (_loc_2 as ShopSellItem).shopItemData;
                _loc_4 = (_loc_2 as ShopSellItem).itemData.itemCode;
            }
            else
            {
                return;
            }
            if (Cache.instance.pack.backPackCache.isPackFull(_loc_4, _loc_3.num))
            {
                if (_loc_3.isShowTips)
                {
                    MsgManager.showRollTipsMsg(Language.getString(20425), MsgRollTipsType.msgRollTips3);
                    ;
                }
                return;
            }
            if (_loc_3.tShopSell.maxBuyLimit > 0)
            {
                _loc_5 = Cache.instance.shop.buyRecords;
                _loc_8 = _loc_3.tShop.shareBuyRecordShop != 0 ? (_loc_3.tShop.shareBuyRecordShop) : (_loc_3.tShop.code);
                if (_loc_5[_loc_8])
                {
                    _loc_6 = _loc_5[_loc_8][_loc_3.tShopSell.itemCode] as SShopBuyPlayerInfo;
                    _loc_7 = _loc_6 ? (_loc_6.amount) : (0);
                }
                if (_loc_3.num + _loc_7 > _loc_3.tShopSell.maxBuyLimit)
                {
                    if (_loc_3.isShowTips)
                    {
                        MsgManager.showRollTipsMsg(Language.getStringByParam(20483, _loc_3.tShopSell.maxBuyLimit), MsgRollTipsType.msgRollTips3);
                        ;
                    }
                    return;
                }
            }
            if (_loc_3.tShop.type == 1)
            {
                if (_loc_3.type == 0 && !Cache.instance.role.enoughMoney(_loc_3.tShop.unit, _loc_3.totalPrize, null, false))
                {
                    if (_loc_3.isShowTips)
                    {
                        if (PlatformConst.isQQ())
                        {
                            if (_loc_3.tShop.unit == EPriceUnit._EPriceUnitGold)
                            {
                                Dispatcher.dispatchEvent(new DataEvent(EventName.ShopOpenQPointExchangeWin, 1));
                            }
                        }
                        if (_loc_3.tShop.unit == EPriceUnit._EPriceUnitCoin || _loc_3.tShop.unit == EPriceUnit._EPriceUnitCoinBind)
                        {
                            this.showCoinBuyWin(_loc_3.totalPrize - Cache.instance.role.getMoneyByType(_loc_3.tShop.unit), _loc_3);
                        }
                        else
                        {
                            MsgManager.showRollTipsMsg(Language.getStringByParam(20427, GameDefConfig.instance.getEPrictUnitName(_loc_3.tShop.unit)), MsgRollTipsType.msgRollTips3);
                        }
                    }
                    return;
                }
                else if (_loc_3.type == 1)
                {
                    if (!Cache.instance.role.enoughMoney(_loc_3.unit, _loc_3.totalPrize, null, false))
                    {
                        if (Cache.instance.role.enoughMoney(_loc_3.unit, _loc_3.totalPrize, null, true))
                        {
                            if (_loc_3.unit == EPriceUnit._EPriceUnitGoldBind && !_loc_3.isUseGoldBuyGoldBind)
                            {
                                ShopFeaturTips.showUseUnbindWin(_loc_2);
                                return;
                            }
                        }
                        else
                        {
                            if (_loc_3.isShowTips)
                            {
                                if (_loc_3.tShop.unit == EPriceUnit._EPriceUnitCoin || _loc_3.tShop.unit == EPriceUnit._EPriceUnitCoinBind)
                                {
                                    this.showCoinBuyWin(_loc_3.totalPrize - MoneyUtil.getSelfMoneyByType(EPriceUnit._EPriceUnitCoin), _loc_3);
                                }
                                else
                                {
                                    MsgManager.showRollTipsMsg(Language.getStringByParam(20427, GameDefConfig.instance.getEPrictUnitName(_loc_3.unit)), MsgRollTipsType.msgRollTips3);
                                }
                            }
                            return;
                        }
                    }
                }
            }
            else if (_loc_3.tShop.type == 2)
            {
                _loc_9 = Cache.instance.pack.backPackCache.getItemCountByItemCode(_loc_3.tShop.unit);
                if (_loc_9 < _loc_3.totalPrize)
                {
                    return MsgManager.showRollTipsMsg(Language.getStringByParam(20427, ItemConfig.instance.getConfig(_loc_3.tShop.unit).name), MsgRollTipsType.msgRollTips3);
                }
            }
            _loc_3.isUseGoldBuyGoldBind = false;
            GameController.guide.hasAskServerBuyItem = true;
            this._shopProxy.buy(_loc_3, _loc_2 as BaseItem);
            return;
        }// end function

        private function updateMoney(param1:Object = null) : void
        {
            this._shopMallModule.updateMoney();
            return;
        }// end function

        private function updatePanicList(param1:Object = null) : void
        {
            return;
        }// end function

        private function updateRuneShop(param1:Object = null) : void
        {
            this._shopMallModule.specialRefreshItems();
            return;
        }// end function

        private function onUpdateRebateNum(param1:Object) : void
        {
            this._shopMallModule.onUpdateRebate();
            return;
        }// end function

        private function onUpdatePlayerRecord(param1:Object) : void
        {
            this._shopMallModule.onUpdateRebate();
            return;
        }// end function

        private function onBuyItem(event:DataEvent) : void
        {
            var _loc_9:int = 0;
            var _loc_2:* = event.data.item as BaseItem;
            var _loc_3:* = event.data.num;
            var _loc_4:* = event.data.useNum;
            var _loc_5:* = event.data.arr;
            var _loc_6:* = _loc_2.itemData.itemCode;
            var _loc_7:* = Cache.instance.shop.curShopId;
            var _loc_8:* = Cache.instance.shop.getRebateInfoDicByItemCode(_loc_6);
            if (_loc_8 && _loc_8.remainInfo)
            {
                _loc_9 = _loc_8.remainInfo.discount;
                if (Cache.instance.role.enoughMoney(EPriceUnit._EPriceUnitGold, _loc_9))
                {
                    if (_loc_8.tShopPanicBuyItem.buyLimit > 0 && _loc_8.remainInfo.leftAmount == 0)
                    {
                        return MsgManager.showRollTipsMsg(Language.getString(20428), MsgRollTipsType.msgRollTips3);
                    }
                    if (_loc_3 > _loc_8.buyLimit)
                    {
                        return MsgManager.showRollTipsMsg(Language.getString(20429), MsgRollTipsType.msgRollTips3);
                    }
                    if (_loc_6 != 0 && _loc_7 != -1)
                    {
                        this._shopProxy.buySellItem(_loc_7, _loc_6, _loc_2, _loc_3, _loc_4, _loc_5);
                    }
                }
                else
                {
                    if (PlatformConst.isQQ())
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.ShopOpenQPointExchangeWin, 1));
                    }
                    Dispatcher.dispatchEvent(new DataEvent(EventName.ShopBuyItemFail, null));
                    return MsgManager.showRollTipsMsg(Language.getString(20430), MsgRollTipsType.msgRollTips3);
                }
            }
            return;
        }// end function

        private function onCloseShop(param1:Object) : void
        {
            this._shopProxy.closeSalePanel();
            return;
        }// end function

        private function openWinAndSelect(event:DataEvent) : void
        {
            var _loc_2:* = undefined;
            var _loc_3:Array = null;
            var _loc_4:ShopTabData = null;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:int = 0;
            var _loc_10:int = 0;
            var _loc_11:ItemData = null;
            var _loc_12:* = undefined;
            var _loc_13:Vector.<TShopSell> = null;
            var _loc_14:int = 0;
            if (event.data is String)
            {
                _loc_3 = ShopUtil.getShopMallItems();
                for each (_loc_12 in _loc_3)
                {
                    
                    _loc_11 = new ItemData(_loc_12.itemCode);
                    if (_loc_11.name == event.data)
                    {
                        _loc_2 = _loc_12;
                        break;
                    }
                }
            }
            if (_loc_2)
            {
                if (_loc_2 is TShopSell)
                {
                    _loc_4 = ShopUtil.getShopMallTabObjByShopCode((_loc_2 as TShopSell).shopCode);
                    if (_loc_4 == null)
                    {
                        return MsgManager.showRollTipsMsg(Language.getString(20431));
                    }
                    _loc_5 = ShopUtil.getTabIndexByTabName(_loc_4.tabIndexName);
                    _loc_13 = ShopConfig.instance.getShopSellItemByShopCode((_loc_2 as TShopSell).shopCode);
                    _loc_9 = _loc_13.length;
                    _loc_10 = 0;
                    while (_loc_10 < _loc_9)
                    {
                        
                        if (_loc_13[_loc_10].itemCode == (_loc_2 as TShopSell).itemCode)
                        {
                            _loc_8 = _loc_10 + 1;
                            break;
                        }
                        _loc_10++;
                    }
                    _loc_6 = Math.ceil(_loc_8 / _loc_4.showItemNum);
                    _loc_8 = (_loc_8 - 1) % _loc_4.showItemNum;
                    if (!GameController.shopMall.isViewShow)
                    {
                        GameManager.instance.popupModuleType(ModuleType.ShopMall);
                    }
                    if (_loc_4.type == ShopTabData.typeGroupShop)
                    {
                        _loc_3 = _loc_4.getItemListCallBack.apply() as Array;
                        _loc_10 = 0;
                        while (_loc_10 < _loc_3.length)
                        {
                            
                            if ((_loc_3[_loc_10] as TShop).code == (_loc_2 as TShopSell).shopCode)
                            {
                                _loc_14 = _loc_10;
                                break;
                            }
                            _loc_10++;
                        }
                        this._shopMallModule.showAndSelectGood(_loc_5, _loc_6, _loc_8, _loc_14);
                    }
                    else
                    {
                        this._shopMallModule.showAndSelectGood(_loc_5, _loc_6, _loc_8);
                    }
                }
                else if (_loc_2 is TShopPanicBuyItem)
                {
                    _loc_4 = ShopUtil.getShopMallTabObjByShopCode(0);
                    _loc_5 = ShopUtil.getTabIndexByTabName(_loc_4.tabIndexName);
                    _loc_3 = ShopConfig.instance.rebateShopMap[Cache.instance.shop.curShopId];
                    _loc_9 = _loc_3.length;
                    _loc_10 = 1;
                    while (_loc_10 < _loc_9)
                    {
                        
                        if (_loc_3[_loc_10].itemCode == (_loc_2 as TShopPanicBuyItem).itemCode)
                        {
                            _loc_8 = _loc_10;
                            break;
                        }
                        _loc_10++;
                    }
                    _loc_6 = Math.ceil(_loc_8 / _loc_4.showItemNum);
                    _loc_8 = (_loc_8 - 1) % _loc_4.showItemNum;
                    if (!GameController.shopMall.isViewShow)
                    {
                        GameManager.instance.popupModuleType(ModuleType.ShopMall);
                    }
                    this._shopMallModule.showAndSelectGood(_loc_5, _loc_6, _loc_8);
                }
            }
            else
            {
                MsgManager.showRollTipsMsg(Language.getString(20431));
            }
            return;
        }// end function

        private function changeTab(event:DataEvent) : void
        {
            var _loc_5:ShopTabData = null;
            if (!GameController.shopMall.isViewShow)
            {
                GameManager.instance.popupModuleType(ModuleType.ShopMall);
            }
            var _loc_2:* = event.data as Array;
            var _loc_3:* = ShopUtil.getTabIndexByTabName(_loc_2[0]);
            var _loc_4:* = _loc_2[1];
            this._shopMallModule.changeTab(_loc_3, _loc_4);
            return;
        }// end function

        private function showUseGoldBuyGoldBindWin(event:DataEvent = null) : void
        {
            return;
        }// end function

        public function showCoinPackWin(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            this.showCoinBuyWin(_loc_2, null, 0);
            return;
        }// end function

        private function showBindCoinPackWin(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            this.showCoinBuyWin(_loc_2);
            return;
        }// end function

        private function showCoinBuyWin(param1:int = 1, param2:ShopItemData = null, param3:int = 1) : void
        {
            var _loc_5:ShopItemData = null;
            var _loc_8:GuideUseItemData = null;
            if (param1 <= 0)
            {
                param1 = 1;
            }
            var _loc_4:* = Cache.instance.pack.backPackCache.getItemByCode(180011017, true);
            if (_loc_4)
            {
                _loc_8 = new GuideUseItemData();
                _loc_8.itemData = _loc_4;
                _loc_8.isGuideToUseItem = true;
                _loc_8.isCountdown = false;
                _loc_8.showTxt = Language.getStringByParam(20432, ItemsUtil.getItemName(_loc_4, "[{0}]"));
                _loc_8.isUseMaxNum = true;
                Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideShowBackPackItem, _loc_8));
                return;
            }
            var _loc_6:* = Math.ceil(param1 / 5000);
            var _loc_7:* = param3 == 1 ? (3009) : (3012);
            _loc_5 = ShopConfig.instance.getFastBuyItemByCode(180010017, _loc_7);
            TipsBuyItemWin.instance.showWin(_loc_5);
            TipsBuyItemWin.instance.setDefaultBuyNum(_loc_6);
            TipsBuyItemWin.instance.useNum = _loc_6;
            if (param2)
            {
                this._shopItemData = param2;
                NetDispatcher.addCmdListener(ServerCommand.CoinUpdate, this.reBuyItem);
            }
            else
            {
                this.clearShopItemData();
            }
            return;
        }// end function

        private function clearShopItemData() : void
        {
            this._shopItemData = null;
            NetDispatcher.removeCmdListener(ServerCommand.CoinUpdate, this.reBuyItem);
            return;
        }// end function

        private function reBuyItem(param1:Object) : void
        {
            if (TipsBuyItemWin.isViewShow && this._shopItemData)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.BuyItem, this._shopItemData));
            }
            this.clearShopItemData();
            return;
        }// end function

        private function getRebatConfig(event:DataEvent) : void
        {
            var _loc_2:* = ClockManager.instance.nowDate.time;
            if (this.lastAskGetRebatTime == 0 || _loc_2 - this.lastAskGetRebatTime >= 3000)
            {
                this.lastAskGetRebatTime = _loc_2;
                this._shopProxy.getSaleConfig();
            }
            else
            {
                NetDispatcher.dispatchCmd(ServerCommand.RebateShopGetSOnsellItemsMsg, null);
            }
            return;
        }// end function

        private function bestGetRebatShopConfig(event:DataEvent) : void
        {
            var _loc_2:* = ClockManager.instance.nowDate.time;
            if (this.lastAskGetRebatTime == 0 || _loc_2 - this.lastAskGetRebatTime >= 3000)
            {
                this.lastAskGetRebatTime = _loc_2;
                this._shopProxy.getSaleConfig();
                this._shopProxy.closeSalePanel();
            }
            else
            {
                NetDispatcher.dispatchCmd(ServerCommand.RebateShopGetSOnsellItemsMsg, null);
            }
            return;
        }// end function

        private function shopShowArrow(event:DataEvent) : void
        {
            if (!GameController.shopMall.isViewShow)
            {
                GameManager.instance.popupModuleType(ModuleType.ShopMall);
            }
            var _loc_2:* = event.data as int;
            this._shopMallModule.changeTab(_loc_2);
            this._shopMallModule.shopShowArrow();
            return;
        }// end function

        private function openQPointExchangeWin(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            ShopQQPointExchangeWin.instance.type = _loc_2;
            ShopQQPointExchangeWin.instance.show();
            ShopQQPointExchangeWin.instance.updateInfo();
            return;
        }// end function

        private function onShopBuyQQItem(event:DataEvent) : void
        {
            var _loc_4:URLVariables = null;
            var _loc_5:ResourceInfo = null;
            var _loc_2:* = event.data as ShopQQData;
            var _loc_3:* = ParamsConst.instance.QQBuyUrl;
            if (_loc_3)
            {
                _loc_4 = new URLVariables();
                _loc_4.payitem = _loc_2.id + "*" + _loc_2.price + "*" + _loc_2.amount;
                _loc_4.goodsmeta = _loc_2.name + "*" + _loc_2.desc;
                _loc_5 = ResourceManager.getInfoByName(_loc_2.url);
                _loc_4.goodsurl = _loc_5.path;
                PHPGetter.getUrlValue(_loc_3, _loc_4, this.onShopBuyQQItemCall);
            }
            return;
        }// end function

        private function onShopBuyQQItemCall(param1:String) : void
        {
            var obj:Object;
            var url_params:String;
            var str:* = param1;
            try
            {
                obj = JSON.parse(str);
                if (obj && obj.url_params)
                {
                    url_params = obj.url_params;
                    BrowerManager.instance.asCallJsFunParam("qdBuyProp", url_params);
                }
            }
            catch (e:Error)
            {
            }
            return;
        }// end function

        private function showQQShopIcon(event:DataEvent) : void
        {
            if (PlatformConst.isQQ())
            {
                if (ParamsConst.instance.isShowQQShop)
                {
                    ShopQQIcon.instance.show();
                }
                Dispatcher.addEventListener(EventName.ShopOpenQPointExchangeWin, this.openQPointExchangeWin);
                Dispatcher.addEventListener(EventName.ShopBuyQQItem, this.onShopBuyQQItem);
            }
            return;
        }// end function

        private function showSeckillingIcon(event:Event = null) : void
        {
            if (Cache.instance.role.entityInfo.level >= GameDefConfig.instance.getSystemOpenLevel(102))
            {
                ShopSecKillingIcon.instance.show();
                Cache.instance.role.roleEntityInfo.removeEventListener(EntityInfoEventName.UpdateLevel, this.showSeckillingIcon);
            }
            else if (ShopSecKillingIcon.isViewShop)
            {
                ShopSecKillingIcon.instance.hide();
            }
            return;
        }// end function

        private function activesStartHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as SClientActive;
            if (_loc_2.type == EActiveType._EActiveTypeSecKilling)
            {
                if (ShopSecKillingIcon.isViewShop)
                {
                    ShopSecKillingIcon.instance.setLeftTimeAndState((_loc_2.endDt.time - ClockManager.instance.nowDate.time) * 0.001, 2);
                    ShopSecKillingIcon.instance.playEffect();
                }
            }
            return;
        }// end function

        private function activesNoticHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as SClientActive;
            if (_loc_2.type == EActiveType._EActiveTypeSecKilling)
            {
                if (ShopSecKillingIcon.isViewShop)
                {
                    ShopSecKillingIcon.instance.setLeftTimeAndState((_loc_2.startDt.time - ClockManager.instance.nowDate.time) * 0.001, 1);
                    ShopSecKillingIcon.instance.playEffect();
                }
            }
            return;
        }// end function

        private function activesEndHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as SClientActive;
            if (_loc_2.type == EActiveType._EActiveTypeSecKilling)
            {
                if (ShopSecKillingIcon.isViewShop)
                {
                    ShopSecKillingIcon.instance.setLeftTimeAndState(0);
                    ShopSecKillingIcon.instance.stopEffect();
                }
            }
            return;
        }// end function

    }
}
